#include "zm.h"
#include "zm_loade.h"
#include "zm_exec.h"

FILE *asm_point;
FILE *exe_point;
char buffer[100];

code_seg code_mem[1024];
int data_mem[1024];
int reg[2];
int stack_mem[128];
int top;


int main(void)
{
	int i;
	asm_point = fopen("asm_code.tmp", "r");
	exe_point = fopen("exe_code.tmp", "w+");
	load_code();

	/*--------------- test code ------------------*/
	for(i = 0; i < 100; i++)
	{
		fprintf(exe_point, "%d: %d\t", i, code_mem[i].op_code);
		fprintf(exe_point, "%d\t", code_mem[i].data1.data);
		fprintf(exe_point, "%d\t", code_mem[i].data2.data);
		fprintf(exe_point, "\n");
	}
	/*--------------test code end ----------------*/

	exec_code();
	fclose(asm_point);
	fclose(exe_point);
}
